package org.fmi.lje.config;

import org.fmi.lje.modules.AntProjectCompilerModule;
import org.fmi.lje.modules.AntProjectLoaderModule;
import org.fmi.lje.modules.BcelModule;
import org.fmi.lje.modules.DummyDiagramModule;

import com.google.inject.Guice;
import com.google.inject.Injector;

public class ProjectConfiguration {

	private final Injector injector;

	private static ProjectConfiguration config;

	private ProjectConfiguration() {
		injector = Guice.createInjector(new AntProjectCompilerModule(), new AntProjectLoaderModule(), new DummyDiagramModule(), new BcelModule());
	}

	public static ProjectConfiguration getProjectConfiguration() {
		if (config == null) {
			synchronized (ProjectConfiguration.class) {
				if (config == null) {
					config = new ProjectConfiguration();
				}
			}
		}

		return config;
	}
	
	public static Injector getInjector() {
		return getProjectConfiguration().injector;
	}

}
